package shayu.coupon.config;

import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

// 分页插件
@Configuration
@EnableTransactionManagement
@MapperScan("shayu.product.dao")
public class MybatisConfig {

    @Bean
    public PaginationInnerInterceptor paginationInnerInterceptor(){
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
        // 设置请求的最大页面大于页后的操作，true返回首页，false继续请求 默认false
        paginationInnerInterceptor.setOverflow(true);
        // 设置请求的单页最大限制，默认500条 -1则不受限制
        paginationInnerInterceptor.setMaxLimit((long)500);
        return paginationInnerInterceptor;
    }

}
